<?php

namespace catchAdmin\basics\model;

use catchAdmin\basics\model\search\BusinessTypeSearch;
use catcher\base\CatchModel;
/**
 *
 * @property int $id
 * @property string $name
 * @property string $abbreviation
 * @property int $tenant_id
 * @property int $creator_id
 * @property int $created_at
 * @property int $updated_at
 * @property int $deleted_at
 */
class BusinessType extends CatchModel
{
    use BusinessTypeSearch;

    public $field = [
        // 主键
        'id',
        // 业务类型
        'name',
        // 简称
        'abbreviation',
        // 商户
        'tenant_id',
        // 创建人
        'creator_id',
        // 创建时间
        'created_at',
        // 更新时间
        'updated_at',
        // 删除时间
        'deleted_at',
//        'type'
    ];

    public $name = 'db_business_type';
    /**
     * 列表
     * @throws \think\db\exception\DbException
     * @return \think\Paginator
     */
    public function getList($tenant_id = 0)
    {
        $where = [];
        if($tenant_id != 0){
            $where[]=['tenant_id','=',$tenant_id];
        }
        return $this->catchSearch()
            ->order('id','desc')
            ->where($where)
            ->withoutField('tenant_id,updated_at,deleted_at,created_at,creator_id')
            ->paginate();
    }
}